package com.sgroupware.modules.leave.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.simpleframe.persistence.hibernate.Page;
import com.simpleframe.persistence.hibernate.Searcher;
import com.sgroupware.modules.leave.Leave;
import com.sgroupware.modules.leave.dao.LeaveDAO;

public class LeaveService {

	@Autowired
	private LeaveDAO leaveDAO;
	
	public Leave getById(long id){
		return leaveDAO.findById(id);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void deletes(Long[] ids){
		leaveDAO.deletes(ids);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void create(Leave leave){
		leaveDAO.save(leave);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void update(Leave leave){
		leaveDAO.update(leave);
	}
	
	//以上自动生成
	
	public Page getPage(Searcher searcher){
		return leaveDAO.getPage(searcher);
	}

}
